<?php

session_start();
require_once("../config.php");
require_once("include/common.php");

$title = '';
$output = '';

// url assoc array
$url_assoc = array(
	// articles
	'articles/category/list' => 'articles/category_list',
	'articles/category/add' => 'articles/category_add',
	'articles/category/edit' => 'articles/category_edit',
	'articles/category/delete' => 'articles/category_delete',
);

// menu assoc array
$menu_assoc = array(
	'articles/category/list'	=> $lang['menu_articles'],
	'beer/catalog/list' => $lang['menu_beer'],
);

$arg = (isset($_GET['q'])) ? $_GET['q'] : '';

if($arg && isset($url_assoc[$arg])) {
	$handler = $url_assoc[$arg].'.php';
	if (file_exists('include/'.$handler)) {
		$current_item = $arg;
	} else {
		$current_item = 'articles/category/list';
		$handler = 'articles/category_list.php';	
	}	
} else {
	$current_item = 'articles/category/list';
	$handler = 'articles/category_list.php';
}

include_once('include/'.$handler);

// menu
$smarty->assign("menu", $menu_assoc);

// message
include_once('include/message.php');
$smarty->assign("message", $message);

// common
$smarty->assign("title", $title);
$smarty->assign("content", $output);

// display template
$smarty->display("index.tpl");



?>